From: Bryan O'Donoghue Date: Mon, 16 Jul 2018 17:21:19 +0000 (+0100) Subject: imx: imx_clock: usb: Add USB clock API X-Git-Url: http://git.openwrt.org/%22https:/collectd.org//%22/%22https:/collectd.org/%22?a=commitdiff_plain;h=6176a4e56b16fa28a914b72fa163929135463f8c;p=project%2Fbcm63xx%2Fatf.git imx: imx_clock: usb: Add USB clock API This set of patches adds a very minimal layer of USB enabling patches to clock.c. Unlike the watchdog or UART blocks the USB clocks pertain to PHYs, the main USB clock etc, not to different instances of the same IP block. As a result this patch-set takes the clock CCGR clock identifier directly rather than as an index of an instance of blocks of the same type. Signed-off-by: Bryan O'Donoghue --- diff --git a/plat/imx/common/imx_clock.c b/plat/imx/common/imx_clock.c index 09cd101b..ccf2aeb1 100644 --- a/plat/imx/common/imx_clock.c +++ b/plat/imx/common/imx_clock.c @@ -132,3 +132,21 @@ void imx_clock_set_wdog_clk_root_bits(uint32_t wdog_clk_root_en_bits) /* Enable the common clock root just once */ imx_clock_target_set(CCM_TRT_ID_WDOG_CLK_ROOT, wdog_clk_root_en_bits); } + +void imx_clock_enable_usb(unsigned int ccm_ccgr_usb_id) +{ + /* Enable the clock gate */ + imx_clock_gate_enable(ccm_ccgr_usb_id, true); +} + +void imx_clock_disable_usb(unsigned int ccm_ccgr_usb_id) +{ + /* Disable the clock gate */ + imx_clock_gate_enable(ccm_ccgr_usb_id, false); +} + +void imx_clock_set_usb_clk_root_bits(uint32_t usb_clk_root_en_bits) +{ + /* Enable the common clock root just once */ + imx_clock_target_set(CCM_TRT_ID_USB_HSIC_CLK_ROOT, usb_clk_root_en_bits); +} diff --git a/plat/imx/common/include/imx_clock.h b/plat/imx/common/include/imx_clock.h index 27858bbd..85586380 100644 --- a/plat/imx/common/include/imx_clock.h +++ b/plat/imx/common/include/imx_clock.h @@ -995,5 +995,8 @@ void imx_clock_enable_usdhc(unsigned int usdhc_id, uint32_t usdhc_clk_en_bits); void imx_clock_set_wdog_clk_root_bits(uint32_t wdog_clk_root_en_bits); void imx_clock_enable_wdog(unsigned int wdog_id); void imx_clock_disable_wdog(unsigned int wdog_id); +void imx_clock_enable_usb(unsigned int usb_id); +void imx_clock_disable_usb(unsigned int usb_id); +void imx_clock_set_usb_clk_root_bits(uint32_t usb_clk_root_en_bits); #endif /* __IMX_CLOCK_H__ */